﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrouponDesktop
{
    public partial class ABMrol : Form
    {
        public ABMrol()
        {
            InitializeComponent();
           
        
        }

      
        private void ABMrol_Load(object sender, EventArgs e)
        {
            BDConnection.FillComboBox(cb_rol, "select desc_rol from CodingSpree.TL_ROLES where estado = '1'");
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
                     
            BDConnection.FillGrid("EXEC CodingSpree.listarFuncionalidades " + cb_rol.Text , dgv_funcion);
            dgv_funcion.Columns[0].Width = 600;
            dgv_funcion.Columns[0].Width = 1000; 
        }

        private void b_alta_Click(object sender, EventArgs e)
        {
            AbmRol.AltaRol AR = new GrouponDesktop.AbmRol.AltaRol();
            AR.Show();
        }

        private void b_baja_Click(object sender, EventArgs e)
        {
            AbmRol.BajaRol BR = new GrouponDesktop.AbmRol.BajaRol(cb_rol.Text);
            BR.Show();
        }

        private void b_modif_Click(object sender, EventArgs e)
        {
            AbmRol.ModifRol MR = new GrouponDesktop.AbmRol.ModifRol(cb_rol.Text);
            MR.Show();
        }

        private void b_refresh_Click(object sender, EventArgs e)
        {
            cb_rol.Items.Clear();
            BDConnection.FillComboBox(cb_rol, "select desc_rol from CodingSpree.TL_ROLES where estado = '1'");
            cb_rol.SelectedIndex = 0;
        }
    }
}
